import request from '@/utils/request'

/**
 * @description: 获取角色
 * @param {*}
 * @return {*}
 */
export function getRoles(params) {
  return request({
    url: '/sys/role',
    method: 'GET',
    params
  })
}

/**
 * @description: 删除角色
 * @param {*}
 * @return {*}
 */
export function deleteRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

/**
 * @description: 添加角色
 * @param {*}
 * @return {*}
 */
export function addRole(data) {
  return request({
    url: '/sys/role',
    method: 'post',
    data
  })
}

/**
 * @description: 编辑角色
 * @param {*}
 * @return {*}
 */
export function updateRole(data) {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * @description: 分配角色权限
 * @param {*}
 * @return {*}
 */
export function assignPermissions(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
